<?php

namespace app\common\model\info;
use app\common\model\BaseModel;
use app\common\model\system\Admin;

class Order extends BaseModel
{

    public static function tablePK(): ?string
    {
        return 'order_id';
    }

    public static function tableName(): string
    {
        return 'order';
    }


    public function getImagesAttr($value)
    {
        return $value ? json_decode($value,true) : [];
    }

    public function getExtAttr($value)
    {
        return $value ? json_decode($value,true) : [];
    }

    public function getShopNameAttr()
    {
        $admin = Admin::getDB()->where('admin_id',$this->admin_id)->find();
        return $admin ? $admin->real_name : '';
    }

}